package com.stockz.watchlist.manager;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.stockz.watchlist.dao.EntryDao;
import com.stockz.watchlist.model.Entry;
import com.stockz.watchlist.model.EntryPrimaryKey;
import com.stockz.watchlist.model.EntrySearchCriteria;

@Service
public class EntryManagerImpl implements EntryManager {

	@Autowired
	private EntryDao entryDao;
	
	@Transactional
	public void persist(Entry entry) {
		entryDao.persist(entry);
	}

	@Transactional
	public Entry merge(Entry entry) {
		return entryDao.merge(entry);
	}

	@Transactional
	public void remove(Entry entry) {
		entryDao.remove(entry);
	}

	public Entry get(EntryPrimaryKey entryPrimaryKey) {
		return entryDao.get(entryPrimaryKey);
	}

	public List<Entry> getByWatchListId(Long id) {
		return entryDao.getByWatchListId(id);
	}

	public List<Entry> find(EntrySearchCriteria criteria) {
		return entryDao.find(criteria);
	}

}
